package com.example.human_resource_management.entry.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

/**
 * 职位表
 * @TableName position
 */
@TableName(value ="position")
@Data
public class Position {
    /**
     * 唯一标识职位
     */
    @TableId(type = IdType.AUTO)
    private Long posId;

    /**
     * 职位名称
     */
    private String posName;

    /**
     * 职位描述
     */
    private String description;

    /**
     * 所属部门ID，外键关联部门表
     */
    private Long deptId;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Position other = (Position) that;
        return (this.getPosId() == null ? other.getPosId() == null : this.getPosId().equals(other.getPosId()))
            && (this.getPosName() == null ? other.getPosName() == null : this.getPosName().equals(other.getPosName()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getDeptId() == null ? other.getDeptId() == null : this.getDeptId().equals(other.getDeptId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getPosId() == null) ? 0 : getPosId().hashCode());
        result = prime * result + ((getPosName() == null) ? 0 : getPosName().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getDeptId() == null) ? 0 : getDeptId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", posId=").append(posId);
        sb.append(", posName=").append(posName);
        sb.append(", description=").append(description);
        sb.append(", deptId=").append(deptId);
        sb.append("]");
        return sb.toString();
    }
}